<?php header("Content-Type:text/html;   charset=utf-8"); ?>
<script type="text/javascript">
	$(function(){
		$("#btnSubmitLogin").bind("click",submitlogin);
		$("#txtUserNameLogin").bind("blur",checkLoginUserName);
		$("#txtPwdLogin").bind("blur",checkLoginPwd);
	});	
	function submitlogin(){
		if(checkLoginUserName()==false)
			return;
		if(checkLoginPwd()==false)
			return;		
		var username = $("#txtUserNameLogin").val();
		var pwd = $("#txtPwdLogin").val();
		var params = {
					login_user:username,
					login_pwd:pwd
				};
		$.ajax({
			type:"post",
			url:"admin.php/manage/login",
			dataType:"json",
			data:params,
			success:function(data){				
				if(data.ReturnCode=="1"){					
					//window.reload();
					window.location="<?php echo base_url()."admin.php";?>";
				}else{
					alert(data.Msg);
					$("#txtPwdLogin").val('');
				}
			}
		});
			
	}
	function checkLoginUserName(){
		var username = $("#txtUserNameLogin").val();
		if(IsEmpty(username)){
			SetError("txtUserNameLogin","用户名不能为空");
			return false;
		}
		ClearError("txtUserNameLogin");
		return true;
	}
	function checkLoginPwd(){
		var pwd = $("#txtPwdLogin").val();
		if(IsEmpty(pwd)){
			SetError("txtPwdLogin","密码不能为空");
			return false;
		}
		ClearError("txtPwdLogin");
		return true;
	}
	
</script>
<div class="pageContent">
	<form class="pageForm required-validate">
		<div class="pageFormContent" style="float: left; width: 500px;"
			layoutH="56">
			<table class="tableNewUser">
				<tr>
					<td>账号：</td>
					<td><input id="txtUserNameLogin" type="text" value="" /></td>
				</tr>
				<tr>
					<td>密码：</td>
					<td><input type="password" id="txtPwdLogin" /></td>
				</tr>
				<tr>
					<td colspan="2" style="line-height: 80px"></td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="buttonActive"
							style="width: 120px; margin-left: 80px; display: block;">
							<div class="buttonContent">
								<button id="btnSubmitLogin" type="button" style="width: 80px">提
									交</button>
							</div>
						</div>
					</td>
				</tr>



				</div>
				</form>
				</div>